package cn.gok.springsecuritydemo05.util;

import java.util.HashMap;

/**
    自定义响应结果集
 */
public class ResultData extends HashMap<String,Object> {


    public ResultData(){

    }

    public ResultData(int code,String msg,Object data){
        this.put("code",code);
        this.put("msg",msg);
        this.put("data",data);
    }

    public static ResultData ok(String msg){
        return new ResultData(200,msg,null);
    }

    public static ResultData fail(String msg){
        return new ResultData(0,msg,null);
    }


    public static ResultData createData(int code,Object data){
        return new ResultData(code,null,data);
    }

    public static ResultData createData(int code,String msg,Object data){
        return new ResultData(code,msg,data);
    }
}
